package router

import (
	. "mock/controller"
	"mock/middleware"
	"net/http"

	"github.com/gin-gonic/gin"
)

/*
InitRouter 路由初始化
*/
func InitRouter() *gin.Engine {
	router := gin.Default()
	// 加载 templates 文件夹下所有的 tmpl
	router.LoadHTMLGlob("../templates/*")
	router.StaticFS("/res", http.Dir("../res"))
	router.GET("/", Index)
	v1 := router.Group("/api")
	v1.Use(middleware.CORSMiddleware())
	{
		v1.Any("/GetImg", GetImg)
	}
	return router
}
